
import React from 'react';
import { Modal } from 'antd';
import ProForm, {  ProFormText} from '@ant-design/pro-form';
import productUpdate from '../../funcs/product_update';

interface UpdateFormProps {
  modalVisible: boolean;
  productid:any;
  values:any;
  onCancel: () => void;
}

const UpdateForm: React.FC<UpdateFormProps> = (props) => {

  return (
    <Modal
      destroyOnClose
      title={"编辑用户"}
      visible={props.modalVisible}
      onCancel={() => props.onCancel()}
      onOk={() => props.onCancel()}
    >
      <ProForm
        initialValues={{
          product_number: props.values.product_number,
          product_name: props.values.product_name,
        }}
        onFinish={async (values) => {
          values["id"]=props.productid;
          productUpdate(values);
        }}
      >
       <ProFormText
            width="md"
            name="product_number"
            label="品号"
          />
       <ProFormText
            width="md"
            name="product_name"
            label="品名"
          />
      </ProForm>
    </Modal>
  );
};

export default UpdateForm;
